import React, { Component } from 'react';
import { Button } from 'antd';
import { connect } from 'dva';

@connect(state => state)
export default class SearchBtn extends Component {


  search = () => {
    const { dispatch, namespace } = this.props;
    dispatch({
      type: `${namespace}/query`,
    });
  }

  render() {
    const { reset, style } = this.props;
    return (
      <div style={style}>
        <Button
          type="primary"
          style={{ marginRight: '1em' }}
          onClick={this.search}
          icon="search"
          className="search"
        >搜索</Button>
        <Button
          onClick={reset}
          icon="sync"
        >重置</Button>
      </div>
    );
  }
}

